import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProtocolMetadataVO, ProtocolMetadataForm, ProtocolMetadataQuery } from '@/api/icpms/protocolMetadata/types';

/**
 * 查询数据协议元数据列表
 * @param query
 * @returns {*}
 */

export const listProtocolMetadata = (query?: ProtocolMetadataQuery): AxiosPromise<ProtocolMetadataVO[]> => {
  return request({
    url: '/icpms/protocolMetadata/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询数据协议元数据详细
 * @param id
 */
export const getProtocolMetadata = (id: string | number): AxiosPromise<ProtocolMetadataVO> => {
  return request({
    url: '/icpms/protocolMetadata/' + id,
    method: 'get'
  });
};

/**
 * 新增数据协议元数据
 * @param data
 */
export const addProtocolMetadata = (data: ProtocolMetadataForm) => {
  return request({
    url: '/icpms/protocolMetadata',
    method: 'post',
    data: data
  });
};

/**
 * 修改数据协议元数据
 * @param data
 */
export const updateProtocolMetadata = (data: ProtocolMetadataForm) => {
  return request({
    url: '/icpms/protocolMetadata',
    method: 'put',
    data: data
  });
};

/**
 * 删除数据协议元数据
 * @param id
 */
export const delProtocolMetadata = (id: string | number | Array<string | number>) => {
  return request({
    url: '/icpms/protocolMetadata/' + id,
    method: 'delete'
  });
};
